Apparatus and methods for texture mapping

ABSTRACT

The invention provides texture mapping techniques that facilitate interactive painting of a three-dimensional virtual surface by a user in object space, without requiring global parameterization. The texture mapping techniques feature rendering texture for a given virtual object using a plurality of composite textures, each formed by blending collapsible texture layers. Texture coordinates in texture space are derived using information determined at the time of surface mesh generation. The invention features dynamic texture allocation and deallocation, allowing a user to interactively modify the shape of a painted, three-dimensional model. Finally, the invention features an architecture for combined graphical rendering and haptic rendering of a virtual object, allowing a user to experience force feedback during the painting of the object in object space.

RELATED APPLICATIONS

This application is related to the commonly-owned U.S. patentapplication entitled, “Apparatus and Methods for Stenciling an Image,”by Levene et al., filed under Attorney Docket No. SNS-016 on even dateherewith, the text of which is hereby incorporated by reference in itsentirety.

FIELD OF THE INVENTION

This invention relates generally to graphical rendering. Moreparticularly, in certain embodiments, the invention relates to texturemapping techniques for the graphical rendering of a virtual object.

BACKGROUND OF THE INVENTION

Certain computer graphics applications graphically render the surface ofa three-dimensional virtual object. The surface of a three-dimensionalvirtual object is generally represented as a mesh of polygonal surfaceelements, for example, triangles. Attributes, such as color intensity,are assigned to surface elements of the virtual object, which are thendisplayed to the user.

The resolution of the surface mesh is typically chosen according to thethree-dimensional complexity of the object. For example, rendering avirtual object having a complex geometry may require a tight mesh ofmany small surface elements, whereas rendering a virtual object ofsimpler shape may be performed with a looser mesh of fewer, largersurface elements.

It is typically not possible to achieve sufficient realism by assigningcolor values to vertices of each surface element, particularly if thesurface elements are large. This problem may be overcome by representingthree-dimensional surface properties of the object using a texture intwo-dimensional space. Texture mapping permits improved resolution ofsurface properties, such as color values, within each surface element,and allows certain operations to be performed on the three-dimensionalobject as if it were flat.

Mapping methods are used to relate points on the surface of athree-dimensional virtual object to corresponding points of atwo-dimensional surface. For example, mapping methods can be used torelate points on the surface of a three-dimensional sphere, such as theEarth, to corresponding points of a two-dimensional map. Certaingraphics applications perform texture mapping for a three-dimensionalvirtual object by establishing a global parameterization that linksevery surface element in the three-dimensional object space to anelement in two-dimensional texture space. The mapping process may not beautomatic and may require manual input from the user. A goal of thesemapping schemes is to produce a coherent two-dimensional texture whoseelements are arranged in such a way that the distortion of the objectsurface is acceptably low. For many complex virtual objects, this posesa problem that is either computationally difficult or intractable.

Furthermore, current graphics applications require a user to paint thesurface of a virtual object in two-dimensional texture space beforeapplying the texture on the virtual object in three-dimensional objectspace. This results in a less interactive, less intuitive experience forthe user.

Moreover, current methods do not allow a user to modify the shape of theobject after its surface has been painted without losing surface datafrom unmodified portions of the object. This is due, in part, to theneed to re-mesh and re-parameterize the entire model following anymodification of the underlying three-dimensional model.

A method of texture painting has recently been introduced to allowtexture mapping without global parameterization. M. Foskey et al.,“ArtNova: Touch-Enabled 3D Model Design,” IEEE Virtual Reality 2002, pp.119-126, (March 2002).

However, there remains a need for mapping methods that allow a user tomodify the shape of an object after its surface has been painted,without losing the surface data from unmodified portions of the object.There also exists a need for a more efficient graphical rendering methodthat is able to support the rendering of complex virtual objects, whilestill allowing a user to interactively paint directly onto the object inobject space. Furthermore, there is a need for a method of blendingtextures while maintaining the interactivity of painting, withoutcreating graphical artifacts.

SUMMARY OF THE INVENTION

The invention provides improved methods of graphically rendering virtualobjects. More specifically, the invention provides improved textureallocation and texture rendering techniques for graphically representingthe surface of a three-dimensional virtual object.

The improved methods allow a user to paint directly onto the surface ofa three-dimensional virtual object. The methods also allow a user tointeractively modify the shape of a painted, three-dimensional objectwithout losing surface data from unmodified portions of the model. Forexample, the improved methods permit a user to paint an object, thencarve portions of the object without losing the painted surface datafrom unmodified portions of the model. The improved methods also permita user to easily switch back and forth between a painting mode and asculpting mode, without having to reallocate texture for unmodifiedportions of the object.

Additionally, the invention provides techniques for blending a brushstroke into a surface texture without creating artifacts in theoverlapping segments of the stroke, and without diminishing theinteractivity of the user's painting experience.

Furthermore, the invention features improved methods for the combinedgraphical and haptic rendering of a virtual object, thereby permitting auser to experience force feedback via a haptic interface device duringthe painting of the object in object space. In this way, a user can“feel” the virtual object as the user paints its surface while, at thesame time, the user observes a display of the object in object space.

Texture mapping methods of the invention include texture allocationmethods and texture rendering methods. Texture allocation refers to theprocess of allocating elements in texture space to corresponding surfaceelements in object space. Texture rendering refers to the process bywhich data in the texture space is sent to a graphics card and/orgraphics application for display. Texture rendering also involvessending information to the graphics application that allows theapplication to correctly relate the texture data to correspondingportions of the surface of the virtual object. Texture rendering methodsof the invention are able to interface with any commercially-availablestandard for three-dimensional rendering and/or three-dimensionalhardware acceleration, including cross-platform standards.

In one embodiment, the invention provides an improved method forgraphically rendering a virtual object by using information producedduring mesh generation. In the process of generating a surface mesh fora voxel-based virtual object, an index is produced for each resultingjack, where a jack is a surface-containing voxel, and a voxel is avolumetric element in object space. Each jack contains a certainconfiguration of surface elements. There are a finite number of possibleconfigurations of surface elements within each jack; and the number ofpossible configurations depends on the mesh generation scheme employed.The index for each jack corresponds to one of the finite number ofsurface element configurations. A first lookup table is created bydetermining a local configuration of texture elements for each of theknown set of surface element configurations. The first lookup table ispreferably computed prior to object rendering. Thus, graphical renderingof a given virtual object proceeds by using the indices for the jacks ofthe virtual object to generate coordinates of texture elements intexture space corresponding to the surface elements of the virtualobject.

Thus, in one embodiment, the invention provides a method of graphicallyrendering a virtual object including the steps of: (1) using an indexcorresponding to each of a plurality of jacks of a voxel-based virtualobject to identify texture elements to which surface elements of thevirtual object are mapped; and (2) generating texture coordinates intexture space for each of the identified texture elements. The index maybe, for example, a marching cubes index, derived from an implementationof a marching cubes algorithm that is used to generate a surface meshfor the virtual object. Alternatively, the index may be, for example, amarching tetrahedra index, derived from an implementation of a marchingtetrahedra algorithm used to generate a surface mesh for the virtualobject.

It is found that dividing the surface of a virtual object into textureregions may overcome hardware limitations in rendering complex virtualobjects. Thus, in one embodiment, the texture space in the graphicalrendering method summarized above includes a plurality of textureregions. Moreover, in addition to steps (1) and (2) above, the renderingmethod may further include the steps of: (3) binding to a graphicsapplication a blended texture corresponding to one of the plurality oftexture regions; and (4) transmitting to the graphics application thetexture coordinates for each of a plurality of surface elementsassociated with the blended texture. The blended texture may be acontiguous texture formed by blending together a plurality of texturelayers, as discussed in more detail hereinbelow.

The index produced for each jack as a result of the mesh generationprocedure can be used to create any number of lookup tables. In oneembodiment, the graphical rendering method includes creating two lookuptables, using a first lookup table to determine to which of a pluralityof texture elements a given surface element is mapped, and/or using asecond lookup table to determine to which of a plurality of positionswithin a texture element a given surface element is mapped. For example,where either zero, one, or two triangular surface elements in objectspace are mapped to a quadrilateral texture element in texture space, afirst lookup table is used to determine to which quadrilateral a giventriangle is mapped, and the second lookup table is used to determine towhich of two positions within the quadrilateral the triangle is mapped.More lookup tables may be used in more complex embodiments, for example,where all of the surface elements of a given jack are mapped to a singletexture element.

The invention also includes methods of dynamic texture allocation anddeallocation, allowing a user to interactively modify the shape of apainted, three-dimensional model, without losing texture data associatedwith unmodified portions of the object. Thus, the invention provides amethod of mapping texture onto a virtual object that includes:allocating texture for at least one newly-created jack of a virtualobject following an object modification; and/or de-allocating texture inthe texture space for at least one newly-eliminated jack of the virtualobject following an object modification.

In one embodiment, the method proceeds by stepping through contiguousblocks of jacks of the model in render order to determine whethertexture allocation is needed therein, and by keeping texturecorresponding to a given jack block together within the same textureregion. This dynamic allocation method provides improved efficiency,since new texture is only created for the modified jacks, and sincethere is no global parameterization required. Advantages are achieved byallocating texture in render order and by keeping texture correspondingto a given jack block together within the same texture region. Thispromotes efficient binding and results in a more efficient texturerendering process. In one embodiment, texture is allocated so as tominimize the number of texture binds required during rendering.

The invention also provides for the compact storage of textureinformation for a virtual object. Since many texture elements maycontain a uniform value, it is efficient to store this information as asingle value, instead of storing values for all texels of every textureelement. It is not necessary to store a full contiguous texture for agiven texture region, since the user does not need to see the texturespace at any time, as all edits may be performed by the user in objectspace. Accordingly, the invention provides a method of creating ablended texture for use in the rendering of a virtual object, the methodincluding the step of blending two or more texture layers, where atleast one of the texture layers is a grid of pointers indicating atleast two of: (i) uniform texture elements, (ii) nonuniform textureelements, and (iii) the location of the nearest free texture element inthe grid.

A blended texture may be created by combining scratch textures, stenciltextures, and/or paint textures associated with one or more brushstrokes. A scratch texture indicates one or more intensity values ofpixels associated with each brush stroke, and a paint texture indicatesone or more color values associated with each brush stroke.

The methods of blending texture presented herein are compatible with amethod of stenciling in which a user may specify a maximum amount bywhich selected portions of an image are allowed to change over thecourse of a series of brush strokes. A first type of stencil textureindicates a level of protection to apply to a given region of an image,and a second type of stencil texture contains brush strokes that areaccumulated and are modified according to the protection levels of thefirst type of stencil texture prior to blending into the image.

Methods of the invention include blending texture layers of at least twoof the three types listed above—scratch texture layers, paint texturelayers, and stencil texture layers—in the order in which the brushstrokes are performed. Enhanced interactivity is achieved, since texturedata is blended into the image pixel-by-pixel in discrete time slices,without interrupting the user's application of brush strokes. Additionalmodel complexity can be handled, since texture layers are blended intocomposite textures for only those texture regions affected by the brushstrokes. Furthermore, one embodiment stores the texture layers in a“collapsed” form that includes both uniform and nonuniform textureelements, and then combines them to form a contiguous blended texturesuitable for binding to a graphics application.

By combining the various texture allocation, texture rendering, andtexture blending methods disclosed herein, the invention provides acomplete graphics application feature that allows a user to paintdirectly on the surface of a virtual object in object space.Accordingly, the invention provides a method of interactivelyrepresenting application by a user of at least one brush stroke directlyonto a virtual object in object space, the method comprising the stepsof: (a) allocating a plurality of texture elements in two-dimensionaltexture space for a plurality of jacks of a virtual object; (b)graphically rendering the allocated texture in real time as a userapplies at least one brush stroke onto the virtual object, whereinrendering includes creating at least one blended texture for binding toa graphics application; and (c) updating the blended textures accordingto the at least one brush stroke applied by the user, wherein the methodinvolves one or more of the following: (i) using an index correspondingto each of a plurality of jacks of the virtual object to identifytexture elements to which surface elements of the virtual object aremapped; (ii) dynamically allocating texture in the texture space; and(iii) blending a set of texture layers corresponding to a first of aplurality of texture regions in the texture space and binding theblended texture to the graphics application during rendering of thefirst texture region.

Finally, the invention features an architecture for combined graphicalrendering and haptic rendering of a virtual object, allowing a user toexperience force feedback during the painting of the object in objectspace.

BRIEF DESCRIPTION OF THE DRAWINGS

The objects and features of the invention can be better understood withreference to the drawings described below, and the claims. The drawingsare not necessarily to scale, emphasis instead generally being placedupon illustrating the principles of the invention. In the drawings, likenumerals are used to indicate like parts throughout the various views.The patent or application file contains at least one drawing executed incolor. Copies of this patent or patent application publication withcolor drawing(s) will be provided by the U.S. Patent and TrademarkOffice upon request and payment of the necessary fee.

FIG. 1A is schematic diagram illustrating a surface mesh of a threedimensional virtual object, according to an illustrative embodiment ofthe invention.

FIG. 1B is a schematic diagram illustrating a flat, coherent texture mapof the object of FIG. 1A, produced using global UV parameterization.

FIG. 2A is a schematic diagram illustrating a three dimensional blockwith a painted face as viewed in object space, according to anillustrative embodiment of the invention.

FIG. 2B is a schematic diagram illustrating texture in a two-dimensionaltexture space that is mapped to the block of FIG. 2A, according to anillustrative embodiment of the invention.

FIG. 3 is a block diagram featuring a method of texture allocation,according to an illustrative embodiment of the invention.

FIG. 4A is a schematic diagram illustrating the partitioning of textureelements associated with a three dimensional virtual object into textureregions in texture space, according to an illustrative embodiment of theinvention.

FIG. 4B is a schematic diagram illustrating a volume in object spacecontaining jack blocks, each made up of 512 contiguous voxels, at leastone of which is a jack (a surface-containing voxel), where the volumecontains surface elements that are mapped to a given texture region intexture space, according to an illustrative embodiment of the invention.

FIG. 5 is a schematic diagram illustrating a hash map of hash mapsidentifying each texture element within a given texture region, whereeach texture element is mapped to a jack within a jack block, accordingto an illustrative embodiment of the invention.

FIG. 6 is a schematic diagram featuring a method of texture renderingthat includes binding a blended composite texture for a given textureregion to a graphics application and sending 2D texture coordinates to agraphics card, according to an illustrative embodiment of the invention.

FIG. 7 is a block diagram featuring a method of texture rendering,according to an illustrative embodiment of the invention.

FIG. 8A is a schematic diagram illustrating a method of texturerendering using two look-up tables, according to an illustrativeembodiment of the invention.

FIG. 8B is a block diagram featuring the texture rendering methodillustrated in FIG. 8A applied to each surface element within each jack,according to an illustrative embodiment of the invention.

FIG. 9 is a block diagram featuring a method of creating the firstlookup table used in the texture rendering method of FIGS. 8A and 8B,according to an illustrative embodiment of the invention.

FIG. 10 is a schematic diagram illustrating a method of identifying thetexture elements associated with each surface element of a jack andgenerating texture coordinates for the identified texture elements,using the pre-computed lookup tables featured in FIG. 8A, according toan illustrative embodiment of the invention.

FIG. 11 is a schematic diagram illustrating a method of blending texturelayers to form a composite blended texture, according to an illustrativeembodiment of the invention.

FIG. 12 is a schematic diagram illustrating a method of representing atexture layer as a grid of pointers, according to an illustrativeembodiment of the invention.

FIG. 13 is a schematic diagram illustrating two pillbox segments of abrush stroke both with and without a double-blending artifact in theoverlapping portion, according to an illustrative embodiment of theinvention.

FIG. 14A is a schematic diagram illustrating the partitioning of thethree dimensional virtual object into texture regions, according to anillustrative embodiment of the invention.

FIG. 14B is a schematic diagram illustrating a method of blendingmultiple texture layers for each texture region, according to anillustrative embodiment of the invention.

FIG. 15 is a block diagram featuring a method of blending paint strokesinto a texture layer where the method protects one or more selectedregions of the image from subsequent editing, according to anillustrative embodiment of the invention.

FIG. 16 is a block diagram featuring a method of blending erase strokesinto a texture layer, where the method protects one or more selectedregions of the image from subsequent editing, according to anillustrative embodiment of the invention.

FIG. 17 is a block diagram featuring a method of texture painting inwhich texture space is dynamically allocated following objectmodification by the user, according to an illustrative embodiment of theinvention.

FIG. 18 is a schematic diagram illustrating a method of texture paintingin which a brush stroke falloff is represented in texture space bycomputing the distance between a point in object space corresponding toa pixel and a point along the center of the brush stroke, according toan illustrative embodiment of the invention.

FIG. 19 is a block diagram featuring a method of texture painting with abrush stroke falloff as illustrated in FIG. 18, according to anillustrative embodiment of the invention.

FIG. 20 is a block diagram featuring a computer system architecture forgraphically rendering a virtual object, according to an illustrativeembodiment of the invention.

FIG. 21 is a block diagram featuring a computer system architecture forgraphically rendering a virtual object, according to an illustrativeembodiment of the invention.

FIG. 22 is an image of a virtual object whose surface has been paintedusing a vertex painting method.

FIG. 23 is an image of the virtual object of FIG. 22, wherein thesurface of the virtual object has been painted by a user in object spaceusing a texture mapping method, according to an illustrative embodimentof the invention.

FIG. 24 is an image of a spherical virtual object with a periodictexture applied along a curved brush stroke, according to anillustrative embodiment of the invention.

FIG. 25 is a schematic diagram illustrating the division of a voxel intosix tetrahedra, used in performing a marching tetrahedra algorithm togenerate a surface mesh for a virtual object, according to anillustrative embodiment of the invention.

DETAILED DESCRIPTION

The invention provides improved methods of graphically rendering thesurface of a three-dimensional virtual object. The invention relates toa method of texture mapping that allows a user to switch between a paintmode and a sculpt mode without losing data. The method also provides foraccurate and efficient rendering without requiring globalparameterization.

Texture mapping is a process by which points on the surface of athree-dimensional virtual object are related to points on atwo-dimensional surface. Texture mapping allows certain operations to beperformed on the three-dimensional object as if it were flat. Thethree-dimensional virtual object is generally represented in objectspace, for example, as a system of elements and/or points in a Cartesian(x,y,z) coordinate system. The surface elements of the object are mappedto texture elements in two-dimensional texture space. The texture isthen rendered by relating texels, or pixels in texture space, tocorresponding points in object space, and displaying them to a user.Additional effects, such as lighting, shadowing, manipulation oforientation and/or size, animation, and other effects, may be performedonce the surface of the object is initially rendered.

Because embodiments of the invention allow a user to paint directly onthe object in object space, the texture space need not be coherent.There is no need to display the texture space to the user. Accordingly,mapping methods of the invention do not require global UVparameterization.

FIG. 1A is a schematic diagram 100 illustrating triangular surfaceelements of a three dimensional virtual object in object space. FIG. 1Bshows a flat, coherent, two-dimensional texture map 120 of the object ofFIG. 1A, produced using global UV parameterization. The elements of thetexture map 120 are shown in texture space in FIG. 1B, and are linked tothe surface elements of the virtual object in object space, shown inFIG. 1A. For many complex virtual objects, producing a coherenttwo-dimensional texture with minimal distortion when mapped to thethree-dimensional object is a computationally difficult (or intractable)problem that may require manual input and/or user trial-and-error.

FIG. 2A is a schematic diagram 200 illustrating a three-dimensionalvirtual object as viewed in object space. The virtual object is athree-dimensional block with one face painted with a two-dimensionalimage of a cell phone. Instead of generating a global UVparameterization, surface elements of the virtual object are mapped totexture elements in a two-dimensional texture space, as shown in theschematic diagram 220 of FIG. 2B. Methods of the invention, discussed inmore detail herein, are used to fill up texture elements allocated tosurface elements of the virtual object as a user paints a virtual objectin object space. The texture need not be coherent, since the user doesnot need to view the texture space when painting.

Texture mapping includes texture allocation and texture rendering.Texture allocation refers to the process of allocating elements intexture space to corresponding elements in object space.

FIG. 3 is a block diagram 300 featuring a method of texture allocation,according to an illustrative embodiment of the invention. The allocationprocess of FIG. 3 begins when the user enters a paint command, orotherwise indicates she is ready to begin painting or otherwise editingthe surface of the virtual object. At this stage, it is possible that noelements in texture space have been allocated to the surface elements ofthe object. Alternatively, the method in the block diagram 300 of FIG. 3may be initiated when the user enters a paint command after havingsculpted the object, added “clay” to the object, or otherwise modifiedthe shape of the object in a way that creates additional surface. Inthis case, some texture elements have been allocated to the surfaceelements of the object, but there may be new surface elements of theobject requiring the allocation of texture elements in texture space. Ifjacks are eliminated as a result of the object edits, texture space isdeallocated by freeing the texture elements corresponding to theeliminated jacks.

The method of FIG. 3 proceeds by stepping through jacks in the objectspace in the order in which the object is rendered. Texture rendering,and rendering order, is discussed in more detail hereinbelow. Textureallocation proceeds from jack to jack in render order by allocatingtexture elements for the surface elements in the jack.

Texture allocation proceeds such that a plurality of texture regions aredefined for the virtual object being rendered. The organization ofallocated texture into texture regions is important in the renderingmethods described herein, since it allows binding and rendering texturefrom one texture region at the time, providing faster, more efficientrendering of complex virtual objects. FIG. 4A illustrates thepartitioning of texture elements—for example, references 402, 403, and404—associated with a three-dimensional virtual object 400 into textureregions. Although later figures portray texture regions as boxes thatdivide up the virtual object into neat segments, as seen at reference406, a texture region is not necessarily so neatly partitioned, sinceits extent is based on how texture is allocated to the jacks in renderorder. For example, texture regions may divide up the virtual objectroughly into the portions indicated at references 408, 410, 412, 414,and 416.

Furthermore, jacks may be organized into jack blocks. For example, ajack block may be an 8×8×8 contiguous block of voxels, although anyother number or configuration of voxels may be used. The voxels within agiven jack block may or may not include surface-containing voxels(jacks). FIG. 4B illustrates a volume 420 in object space encompassingthe jack blocks that contain all the object surface elements that aremapped to a given texture region. One of the jack blocks is shown atreference 422. The surface of the virtual object that intersects thevolume 420 is shown at reference 423. The jack block at reference 422contains 8×8×8 (=512) voxels. A single jack is shown at reference 424.Jack 424 contains three object surface elements 426, 428, 430.

The allocation method produces a list, for example, the “Texture Mapper”depicted in the system architecture of FIG. 20 and FIG. 21. The listprovides a “map” identifying texture elements corresponding to the jacksof the virtual object. The list may be a hash map identifying eachtexture element corresponding to surfaces in each of a plurality ofjacks. More preferably, the list is a hash map of hash maps identifyingeach texture element corresponding to surface(s) in each jack of eachjack block. The Texture Mapper stores all the texture elementidentifiers owned by a particular jack. For example, FIG. 5 illustratesa hash map of hash maps 500 identifying each texture element (“Q0, Q1,Q2, Q3”), within a given texture region (“TR 5”), where each textureelement is mapped to a jack (“Local Jack”) within a jack block(“Block”).

The texture allocation method of FIG. 3 begins by considering the firstjack of the first jack block of the virtual object, in render order, anddetermining in step 302 whether texture has been allocated for thisjack. If not, step 304 directs that a first texture region be created ifnone currently exist, or, alternatively, proceeds to the current textureregion. Step 306 determines whether there is enough space in the currenttexture region to contain the surface elements in the current jack. Thecomputation in step 306 may involve requiring a margin of extra textureelements in each texture region to accommodate possible surfaceexpansion in a jack block, due to edits that change the amount ofsurface of the virtual object in a given jack block.

If there is enough space in the current texture region for the currentjack, step 310 of FIG. 3 directs that a sufficient number of textureelements needed for the current jack be allocated. In an embodimentwhere texture elements are quadrilaterals (quads) and surface elementsare triangles, step 310 may involve pairing surface elements that sharea common edge, and mapping each pair to an available quad. If there isnot enough space in the current texture region for the current jack,step 308 of FIG. 3 directs that a new texture region be created, andthat all texture elements corresponding to jacks within the current jackblock be moved into the new texture region. Thus, in this instance, theentire jack block's texture elements are moved as a unit to a newtexture region where more texture elements are available. Then, entriesfor the transferred texture elements are updated in the Texture Mapper,accordingly.

Step 312 of FIG. 3 proceeds if texture has previously been allocated forthe current jack, or, alternatively, following the allocation of texturefor the current jack in step 310. Step 312 determines whether thecurrent jack is the last jack in the current jack block. If not, step318 proceeds to the next jack in the current jack block, and theallocation process starts again at step 302 with the new jack. If thecurrent jack is the last jack in the current jack block, step 314determines if there is a jack block remaining. If no jack block remains,the allocation process is complete. If there is a jack block remaining,step 316 proceeds to the first jack of the next jack block, and theprocess starts again at step 302 with the new jack.

Texture allocation methods of the invention support dynamic textureallocation and deallocation—that is, the creation and/or elimination oftexture elements corresponding to edited portions of the object, withoutaffecting texture previously allocated for texture elementscorresponding to unedited portions of the object. In this way, theinvention supports a quick transition from a sculpting mode, or otherobject editing mode, to a painting mode, or other surface editing mode,and vice versa. The allocation method of FIG. 3 allocates new textureelements when new jacks are created as a result of object edits. Theallocation method deallocates (frees, erases) texture elements whentheir associated jacks are destroyed. When the surface within a voxelchanges, for example, due to surface-based editing such as tugging orany operation involving rasterization, a slightly modified method isperformed. First, texture previously allocated to the edited jack ispreserved by caching it, then the old texture is deallocated while thenew texture is reallocated according to the method of FIG. 3. Finally,the cached texture is resampled into the new texture where the surfaceelements have not changed significantly.

In addition to texture allocation, texture mapping involves the processof texture rendering. While texture allocation need only be performed iftexture has not yet been allocated for a given virtual object or whenthere has been a change that affects the amount of surface of thevirtual object, texture rendering is performed once for every frame thatis graphically rendered. For example, texture rendering may take placeup to about 30 times per second, or more, depending on the complexity ofthe virtual object being rendered and the capability of the computersystem and graphics application used. Texture rendering involves sendingdata representing the contents of each texture element to a graphicsrendering interface, such as a graphics card and/or graphicsapplication. Thus, the texture rendering methods of the invention mayoptionally include using a commercially-available platform for graphicalrendering and hardware acceleration. Moreover, the texture renderingmethods of the invention may optionally include the use of acommercially-available graphics application programming interface. Alongwith sending data representing the contents of each texture element,texture rendering methods of the invention send texture coordinates tothe graphics rendering interface/application in order to correctlyrelate the texture data to corresponding portions of the surface of thevirtual object.

FIG. 6 is a schematic diagram 600 illustrating the binding of a blendedcomposite texture 602 for a given texture region to a graphicsapplication and sending texture coordinates to the graphics applicationvia a graphics card 604. Hardware limitations in the rendering ofcomplex virtual objects may be overcome by dividing all the texture thatis mapped to a virtual object into a set of texture regions according tothe method of FIG. 3.

FIG. 7 is a block diagram 700 featuring a method of texture rendering,according to an illustrative embodiment of the invention. Step 702indicates binding a blended composite texture representing the currenttexture region to the graphics application. Methods of blendingcollapsible texture layers to form blended composite textures aredisclosed in more detail hereinbelow. In a preferred embodiment, theblended composite texture is a contiguous texture containing all thetexture information required by the graphics application in thegraphical rendering of the surface of the virtual object. Step 704indicates the method begins with the first jack of the first jack blockof the current texture region; the steps which follow show the order inwhich the other jacks are considered. In step 706, the rendering methoddetermines two-dimensional texture space coordinates for surfaceelements in the current jack block, and transmits the information foruse by the graphics application. The determination of texture spacecoordinates for the surface elements in a given jack is an importantstep in the texture rendering process, and is described in more detailin FIGS. 8A, 8B, 9, and 10.

Steps 708, 710, 712, and 714 of FIG. 7 show the order in which texturespace coordinates are determined for elements within a given textureregion. Step 706 is performed for each jack of the current jack block,then for each jack of the next jack block within the current textureregion. The process continues until step 712 determines that the lastjack of the last jack block in the current texture region has beenreached. Then, step 716 determines whether the current texture region isthe last region allocated for the virtual object. If so, the renderingprocess has completed its cycle. If not, step 718 indicates that theprocess returns to step 702 with the blended composite texture for thenext texture region. The method proceeds until all jacks have beenrendered.

In another embodiment, the method of texture rendering proceeds jackblock by jack block, irrespective of texture regions. Here, unlike themethod shown in FIG. 7, jack blocks are not rendered in an orderaccording to the texture region in which they lie. As rendering proceedsfrom jack block to jack block, the texture region in which the currentjack block lies is first bound to the graphics application beforetexture space coordinates are determined for surface elements in eachjack of the current jack block. A single texture region may be boundmultiple times, depending on the jack block render order. The renderorder may be adjusted to reduce the number of texture region bindingsrequired.

FIGS. 8A, 8B, 9, and 10 illustrate methods of determining texture spacecoordinates for the surface elements in a given jack. FIG. 8A is aschematic diagram illustrating the use of two lookup tables derived froman index corresponding to the given jack. Each jack has an index that isproduced as a result of a mesh generation process for the voxel-basedvirtual object, indicating which of a known set of surface elementconfigurations describes the current jack. The index may be, forexample, a marching cubes index, derived from an implementation of amarching cubes algorithm that is used to generate a surface mesh for thevirtual object. Alternatively, the index may be, for example, a marchingtetrahedra index, derived from an implementation of a marchingtetrahedra algorithm that is used to generate a surface mesh for thevirtual object. At a given point in the rendering process, the surfacemesh, with its corresponding indices, may be an initial mesh generatedfor the virtual object, or the surface mesh may be a re-mesh generateddue to a change in the surface of the virtual object, for example,following a carving or other object editing function performed by theuser.

FIGS. 8A and 8B feature a texture rendering method using two lookuptables to determine texture coordinates for each surface element withina given jack. Other embodiments of the invention use one lookup table,or three or more lookup tables. A lookup table may be a list, a file, ormay assume any other form that provides information about surfaceelements of the virtual object using indices from mesh generation. In apreferred embodiment, the lookup tables are pre-computed, prior to useduring graphical rendering. Steps 1-4 illustrated in the schematicdiagram of FIG. 8A correspond to the similarly numbered steps in theblock diagram 850 of FIG. 8B.

The method illustrated in FIGS. 8A and 8B proceeds by using the TextureMapper to determine the identification of all texture elements that aremapped to surface elements within a given jack. This is performed foreach jack of the virtual model, according to the method illustrated inFIG. 7, and as indicated at reference 852 of FIG. 8B. For example, thejack 802 in FIG. 8A contains three surface elements—labeled Tri 1, Tri2, and Tri 3—that have been allocated two texture elements (here,quadrilaterals, or “quads”), labeled “17” and “201” in the currenttexture region. The texture elements were allocated according to thetexture allocation method illustrated in FIG. 3.

The rendering method of FIG. 8B proceeds by performing steps 2, 3, and 4for each surface element within the current jack as indicated byreference 854. Step 2 uses the first lookup table to determine in whichtexture element the current surface element is mapped; step 3 uses thesecond lookup table to determine to which position within the textureelement the current surface element is mapped; and step 4 determinestexture coordinates within the current blended composite texture towhich the current surface element is mapped.

FIG. 8A illustrates steps 2, 3, and 4, described above, performed for asurface element, labeled Tri 3, in a given jack 802 produced by amarching cubes mesh generation algorithm and having marching cubes index“45”. Step 2 of FIG. 8A shows that the first lookup table, LUT 1, isused to determine in which of the two quads for this jack the surfaceelement, Tri 3, is mapped. Tri 3 is located in Quad 2 of 2 allocated forjack 802. Step 3 of FIG. 8A shows that the second lookup table, LUT 2,is used to determine to which of two possible positions within thetexture element the surface element is mapped. Tri 3 is located in thebottom half of Quad 2 of 2 (position 1). Finally, step 4 of FIG. 8Ashows that global texture coordinates are determined for the surfaceelement, Tri 3, by converting the local texture coordinates of itsvertices—(0,0), (1,0), and (0,1)—into global texture coordinates withinthe current texture region using the identification of the textureelement, Quad 201, in the Texture Mapper.

FIG. 9 and FIG. 10 illustrate methods of creating lookup tables used inthe texture rendering method of FIGS. 8A and 8B. FIG. 9 is a blockdiagram 900 featuring a method of creating a first lookup tableindicating in which texture element a given surface element is mapped.The method attempts to pair triangles that share a common edge togetherinto the same quad. For the case of a mesh generated using a marchingcubes algorithm, there are at most 4 connected series of triangles inany given jack, where a “series” can be one triangle unconnected toanother triangle in the jack, or a “series” can be more than onetriangle connected to each other in the jack. Therefore, a jack in thisinstance can consume at most 4 texture quads, each containing either oneor two triangles. The method in FIG. 9 of creating the first lookuptable finds unpaired triangles with the fewest neighbors 908 by steppingthrough nested categories: each jack with a known marching cubes index902, each connected series of triangles 904, and each remaining triangleof a connected series to be paired 906. Step 910 determines whether agiven triangle (surface element) has an unpaired neighbor. If so, step912 pairs the current triangle with its neighbor into an unoccupied quad(texture element). If not, step 914 places the current triangle into anunoccupied quad alone.

The results of the method of FIG. 9 can be seen in FIG. 8A. Since Tri 1and Tri 2 share a common edge, they are paired into a single quad—Quad 1of 2 in FIG. 8A, which is Quad 17 of the current texture region. Tri 3shares a common edge with Tri 1, but since Tri 1 is already paired withTri 2, Tri 3 is allocated its own texture element—Quad 2 of 2 in FIG.8A, which is Quad 201 of the current texture region.

FIG. 10 illustrates the creation of the second lookup table. In thisembodiment, when a triangle pair is assigned to an unoccupied quad, thefirst triangle is assigned to the bottom-left half of the quad, withvertex coordinates at the top-left, bottom-left, and bottom-rightcorners, while the second triangle is assigned to the top-right half ofthe quad with vertex coordinates at the top-left, top-right, andbottom-right corners. When a single triangle is placed in an unoccupiedquad alone, it is assigned to the bottom-left half of the quad. Thus,Tri 3, shown in FIG. 8A and FIG. 10, is placed into the bottom-left halfof Quad 201. Thus, as seen in FIG. 8A and at reference 1004 of FIG. 10,Tri 3 has local vertex coordinates (0,0), (1,0), and (0,1). FIG. 10shows that triangle Tri 1 has local vertex coordinates (0,0), (1,0), and(0,1) in Quad 17 and its pair, Tri 2, has local vertex coordinates(1,1), (1,0), and (0,1).

More sophisticated surface-element-to-texture-element mapping schemesare possible. For example, in one embodiment, where there are a finitenumber of surface element configurations within a jack that are createdduring mesh generation, texture elements indicative of each possiblesurface element configuration within a jack can be pre-computed so thata single texture element is mapped to all the surfaces within a givenjack.

When the user paints a virtual object in object space, values areassigned to corresponding texels in texture space. The user “paints”texture elements, in essence, via the link between surface elements ofthe virtual object in object space and corresponding texture elements intexture space. This process is invisible to the user, who only sees theeffects of the painting operation in object space. However, the processof blending brush strokes, occurs in texture space using two-dimensionaltexture compositing techniques. Graphical user input fills texturelayers corresponding to a given texture region; then, the texture layersare combined into a blended composite texture for that texture region.The blended composite texture for each texture region is boundone-at-a-time to a graphics application during texture rendering, asdescribed in more detail elsewhere herein. FIG. 11 features a schematicdiagram 1100 illustrating the blending of texture layers 1102, 1104,1106, 1108, 1110 to form a composite blended texture 602 for a giventexture region. Blending may include performing one or more texturecompositing operations. There may be any number of texture layers thatare blended to form a given blended texture 602. The texture layers mayinclude, for example, scratch textures, paint textures, and/or stenciltextures.

A scratch texture indicates one or more intensity values of pixels(and/or texels) associated with each brush stroke. A scratch texture maybe thought of as a “template” describing the brush characteristics; forexample, the scratch texture may contain intensity values that reflectbrush size and/or edge effects. The brush may be assigned a certainwidth, a varying width along the length of a stroke, a certain shapecharacteristic of the end of the brush, and/or a “falloff” or transitionregion along a portion of the brush, such as the edges of the brush. Theintensity values in the scratch texture may be used to determine theintensity of a selected color at a given pixel within the brush stroke.For example, a scratch texture comprising values representing a givenbrush stroke may represent a “falloff” region of the brush stroke byassigning intensity values from 1 (full intensity) at the center, ornear to the center, of the stroke, down to 0 (no intensity) at points atthe edges of the stroke. Thus, a blended composite of the scratchtexture with a paint texture containing a single monochromatic colorvalue would portray a paint stroke with the most intense color at thecenter of the stroke, falling off to no color at the very edges of thestroke.

As used herein, a brush stroke is an operation performed on a collectionof pixels in a texture and/or image. Brush strokes include, for example,paint strokes, erase strokes, pen strokes, lines, characters, and text.The manner in which a brush stroke operates on a collection of pixelsmay be determined interactively by a user, as in the performance of apaint or erase stroke, using a graphical interface device, ornon-interactively—for example, in batch—without any user input. Thus,brush strokes include, for example, batch deletions, batch pastes, andflood fills. The pixels/texels on which a brush stroke operates may beeither contiguous or non-contiguous.

The texture layers 1102, 1104, 1106, 1108, 1110 portrayed in FIG. 11 mayalso include stencil textures. Stenciling allows a user to moreaccurately control the editing of an image by specifying a maximumamount by which selected portions of the image are allowed to changeover the course of a series of brush strokes. Stencil textures aredescribed in more detail herein, for example, in the descriptions ofFIG. 15 and FIG. 16.

Texture layers may be stored in “collapsed” form, as shown in FIG. 12,thereby requiring less memory and improving the efficiency of therendering process. As shown in FIG. 11, the collapsed textures arecombined to form a contiguous blended texture suitable for binding to agraphics application. Alternatively, the blended texture may be storedin collapsed form.

A representative contiguous texture 1200 is shown in FIG. 12. Thecontiguous texture 1200 contains quadrilateral texture elements. Othershapes may be used, alternatively. All texels of each of the elements ofthe contiguous texture 1200 are represented in normal “expanded” form.Where a given texture element contains limited data, for example, asingle color value, it is not necessary to store this value for each ofthe texels of the given element. Thus, a collapsible texture 1202 cansave memory by representing uniform texture elements with the limiteddata, for example, the single color value applied to all texels of theelement.

The collapsible texture 1202 in FIG. 12 is a grid of elements indicatinguniform texture elements, non-uniform texture elements, and locations ofthe nearest free texture element in the grid. Here, an element of thegrid may be a value of any bit length (i.e. 32-bit) that represents, forexample, the color value of a uniform (collapsed) texture element 1208,the location of the next free grid element 1210, or the location 1212 ofa non-uniform (expanded) texture element 1206, as shown in the legend1204 of FIG. 12. For each collapsible texture 1202, there may be ashadow texture that is used to interpret what kind of information thevalues of the grid 1202 represent. For example, a shadow texture maycomprise codes corresponding to the elements of the grid, 1202 thatindicate whether a grid element is a uniform quad value, a location oridentification number of a free quad, or a pointer to a non-uniformquad.

Texture layers are combined in discrete time slices to form the blendedcomposite image in a pixel by pixel manner, without interruptingapplication of additional brush strokes by the user. Each brush strokewithin a given texture region may be represented using a scratchtexture. An individual brush stroke is divided into a series of strokesegments that are separately blended into the scratch texture. Theinvention provides a method that prevents double-blending of overlappingportions of segments of the individual brush stroke, thereby avoidingundesired artifacts at the segment ends.

FIG. 13 shows a schematic diagram 1300 illustrating two segments of abrush stroke both with 1302 and without 1304 a double-blending artifactin the overlapping portion. Each segment of the brush stroke isrepresented with a pillbox shape. Brush stroke 1302 is divided into twosegments 1306 and 1308, and brush stroke 1304 is divided into twosegments 1310 and 1312. The overlapping portion of the two segments inbrush stroke 1302 results in higher intensities in the circular region1314. The blending method performed for brush stroke 1304 avoids thehigher intensities in the circular region where the ends of thepillboxes overlap, resulting in a brush stroke of even intensity.

The blending method uses a scratch texture to describe the size andshape of the brush. By assigning a new pixel value to the scratchtexture only if it exceeds the existing value at that pixel, thedouble-blending artifact is avoided. The blending method includes thesteps of: (1) receiving brush stroke data from a graphical userinterface; (2) for each of a plurality of pixels of a scratch texture,comparing a received pixel value to a value previously written at thecorresponding pixel of the scratch texture and assigning the receivedvalue to the corresponding pixel of the scratch texture only if itexceeds the existing value; and (3) blending the scratch texture intothe target image. Here, the scratch texture is a texture having one ormore intensity values of pixels (and/or texels) associated with eachbrush stroke. The blending step may be performed substantially uponcompletion of the performance of the paint stroke by the user. Eachscratch texture is emptied or deleted after its contents are blended, sothat each new brush stroke fills an empty scratch texture.

In order to enhance interactivity, texture layers are blended in theorder in which the brush strokes they represent are performed. Texturedata is blended pixel-by-pixel in discrete time slices, withoutinterrupting the user's application of additional brush strokes. Thus,multiple scratch textures layers may be blended together where eachscratch texture represents an individual brush strokes within a giventexture region. This technique is demonstrated in FIGS. 14A and 14B.

FIG. 14A is a schematic diagram 406 conceptually illustrating thepartitioning of a three dimensional object in object space into multipletexture regions. FIG. 14B illustrates the blending of multiple texturelayers for each texture region in which a brush stroke falls. When theuser begins a brush stroke, a new scratch layer is added for the textureregion into the topmost layer. For example, FIG. 14B shows brush stroke1401 applied by a user in object space, conceptually depicted asaffecting texture in texture regions 1402, 1404, and 1406; brush stroke1405 affects texture regions 1406, 1408, and 1412; and brush stroke 1409affects texture regions 1410, 1406, and 1412. As the new scratch layeris added for a given texture region into the topmost layer, thebottom-most scratch layer for that region is being blended into theblended composite texture for that region. The raised tiles 1402, 1404,1406, 1408, 1410, and 1412 in FIG. 14B represent the topmost layer fortheir respective texture regions.

The texture layers that are combined to form a blended composite texturefor a given texture region may include stencil textures. Stenciltextures are used to protect a selected region of an image fromsubsequent editing. The methods of blending texture are compatible withstenciling methods that allow a user to more accurately control theediting of an image by specifying a maximum amount by which selectedportions of the image are allowed to change over the course of a seriesof brush strokes.

The stenciling methods involve protecting an image using a first textureand a second texture, rather than a single texture alone. FIG. 15 is ablock diagram 1500 featuring a method of blending brush strokes into atexture layer protected by application of a stencil. The first texture1502 includes texels with values indicating levels of protection to beapplied to corresponding texels of the protected texture 1504. Forexample, the first texture 1502 may be a map of values indicating one ormore regions of the texture to be protected from editing by subsequentpaint strokes. The level of protection may be from 0% to 100%, where 0%indicates no protection from subsequent edits, and 100% indicates fullprotection from subsequent edits. A level between 0% and 100% indicatespartial protection, and may correspond to a minimum opacity above whichto maintain at least a portion of the protected region throughout theapplication of subsequent brush strokes.

Overlapping portions may result from multiple overlapping brush strokesand/or from a single brush stroke that overlaps itself. Despite thepresence of any overlapping portion(s), and despite the number of brushstrokes applied following activation of the stencil, methods of theinvention can prevent the opacity of an initial version, or initiallayer, of the selected region(s) from decreasing below a specifiedminimum in any subsequent composite.

The stenciling method illustrated in FIG. 15 proceeds by directinggraphical input, for example, brush strokes 1506, into a second texture1508, rather than directly blending the graphical input into theprotected texture 1504. The second texture 1508 acts as a bufferaccumulating graphical input. The protected texture 1504 may be combinedalong with other texture layers into a blended composite texture for thegiven texture region, or, alternatively, the protected texture 1504 may,in fact, be the blended composite texture for a given texture region.

The interactivity of the user's image editing experience may bepreserved by use of a display texture 1510. In one embodiment, texels ofthe protected texture 1504 are copied directly into a display texture1510, while texels of the second texture 1508 are modified according tothe first texture 1502, then blended into the display texture 1510.

User interactivity is preserved by modifying texels of the secondtexture and blending the modified texels into the display image on atexel-by-texel basis. In this way, the user sees the resulting imageemerge, subject to the user-specified protection, as the user continuesto apply brush strokes.

The display texture can reflect real-time user brush strokes, as well aspreserve a minimum opacity of the original texture layer within aprotected region, regardless of the number of brush strokes that follow.This is because, in a preferred embodiment, each update of the displaytexture is performed by: (1) re-copying texel values of the originalprotected texture layer into the display texture texels, and then (2)compositing the modified second texture texels with the display texturetexels. The display texture 1510 may be updated at a rate of up to about30 times per second, or more, depending on the complexity of the imageand the computational speed for graphical rendering. The update rate maybe less for more complex images or for slower machines—for example, fromabout 10 times per second to about 20 times per second.

The use of a display texture 1510 is optional. Whether or not a displaytexture 1510 is used, methods of the invention can preserve a minimumopacity of the original image layer within a protected region byaccumulating graphical input in the second texture 1508, modifying thesecond texture 1508 using the first texture 1502, and, subsequently,blending the modified second texture 1508 into the protected texture1504.

The user may provide one or more signals indicating the beginning and/orending of the period of time in which brush strokes are accumulated inthe second texture. The user provides a first signal, such as a buttonclick, to indicate the beginning of the application of a stencil.Alternatively, the stencil may self-activate once the user defines thefirst texture. The step of defining the first texture may includeindicating: (1) one or more regions of the surface of a virtual objectto be protected; and/or (2) one or more levels of protection to applywithin the one or more regions. The surface elements within the regionindicated by the user in object space are mapped to correspondingtexture elements in texture space.

Once the stencil is active, graphical input representing brush strokesby the user are directed into the second texture 1508. When the user hascompleted one or more brush strokes, the user may provide a secondsignal to deactivate the stencil. In one embodiment, once the stencil isdeactivated, the second texture 1508, modified by the first texture, isblended into the protected texture 1504.

Real-time display of erase strokes requires modification of paintstrokes applied both before and after activation of the stencil. FIG. 16is a block diagram 1600 featuring a stenciling method in which erasestrokes 1602 are blended into a protected texture 1504. Generally, thesecond texture 1508 contains data from paint strokes applied afteractivation of the stencil, but not before. Therefore, the step ofmodifying a value of one or more texels of the protected texture 1504 isperformed prior to copying texels of the protected texture 1504 into thedisplay texture 1510 and compositing the modified second texture texelswith the display texture texels. Texel values of the protected texture1504 are modified according to the level(s) of protection indicated inthe first texture 1502.

In one embodiment, a minimum opacity of an original texture layer may bepreserved despite repeated erase strokes within the protected region,where overlapping erase strokes result in the attenuation of a texelvalue of the protected texture down to a minimum value, but no further.The minimum value is determined from the protection level of that texelas indicated in the first texture 1502. In cases where texels arerepresented by RGBA quadruples, the first texture 1502 may be used toderive a minimum alpha channel value below which the texel values of theprotected texture 1504 are not allowed to fall. Pixel values and/ortexel values include values of any bit depth, where bit depth generallyranges from 1 to 64 bits per pixel. Pixel values include grayspacevalues, RGB colorspace values, RGBA colorspace values, or any othercolorspace values, such as HSL, HSV, CMY, CMYK, CIE Lab, and R-Y/B-Y.Preferred methods of the invention are performed using 24-bit, RGBAcolorspace pixels, although any bit depth and/or colorspace format maybe used.

The display methods discussed herein work where a user performs paintstrokes, erase strokes, or both paint and erase strokes, while thestencil is active. Additionally, these display methods preserve theinteractivity experienced by the user during the editing process, whilemaintaining the protection offered by the stenciling methods describedherein.

Methods of the invention involve the modification of paint colors ofimages and/or textures, as well as the blending of paint colors betweentwo or more images and/or textures. For example, in one embodiment,pixels of the second texture 1508 are modified using the first texture1502, where the first texture 1502 is a map of values indicatingprotection levels for the protected texture 1504 and the second texture1508 contains accumulated graphical input. A texel of the second texture1508 may be modified by attenuating its color value according to theprotection level in the first texture 1502 corresponding to that texel.

Blending of images and/or textures may be performed using one or morecompositing operations. For example, in one embodiment, texels of thesecond texture 1508 are blended into the protected texture 1504. Thismay be done by performing a compositing operation, such as an “overlay”operation in RGBA colorspace, between the second texture 1508 and theprotected texture 1504.

Because texture is dynamically allocated, a user may seamlessly switchbetween an object modification mode (for example, a sculpt mode) and asurface paint mode without losing paint information for unaffectedsurfaces of the virtual object. FIG. 17 is a block diagram 1700featuring a method of texture painting in which texture space isdynamically allocated following modification of the virtual object. FIG.17 may represent part or all of a graphics thread for graphicallyrendering the virtual object. Throughout the process depicted in FIG.17, the user may apply any number of brush strokes directly onto thethree dimensional object in object space using, for example, a hapticinterface device. The user may also switch from the painting feature toa sculpting feature, and back again. For example, the method of FIG. 17may be initiated every time the user enters the painting feature, forexample, by clicking an icon or button, or by providing some othersignal.

Step 1702 of the painting method illustrated in FIG. 17 allocatestexture space for the virtual object according to methods describedherein, for example, the texture allocation method depicted in FIG. 3.Step 1704 describes the creation and rendering of blended compositetextures for each of a plurality of texture regions, as shown, forexample, in FIGS. 7 and 11. Step 1704 may be performed multiple timesper second, for example, up to about 40 times per second or more. Formore complex virtual objects, step 1704 is performed at a slowerrate—for example, from about 10 Hz to about 30 Hz.

Step 1704 of FIG. 17 performs a set of substeps for each of a pluralityof texture regions, as indicated at reference 1706. The substeps includeupdating texture layers according to user brush strokes 1708, combiningthe texture layers into blended composite textures 1710, binding thecomposite texture to a graphics application (where the graphicsapplication provides hardware and/or software for display of the virtualobject in object space) 1712, and transmitting texture coordinates tothe graphics application 1714. After one or more render cycles of step1704, the method determines in step 1716 whether the user has modifiedthe virtual object such that any surface is destroyed or new surface iscreated. If not, the creation and rendering of blended compositetextures of step 1704 continues. If surface is created or destroyed, thesurface mesh for the virtual object is updated according to the usermodification. For example, if the user has sculpted the object and hasre-entered the painting feature, step 1718 updates the surface mesh byremeshing at least a portion of the virtual object. The mesh generationstep may employ a marching cubes algorithm, for example, if the model isa voxel-based model. Then, the method of FIG. 17 proceeds to step 1702,where texture is allocated, for example, according to the method of FIG.3, which prevents reallocation of texture for surface elements inunmodified jacks. The creation and rendering of blended textures in step1704 then continues as before.

An embodiment of the painting method of FIG. 17 allows a user to paintwith brush strokes whose characteristics are reflected in correspondingscratch textures. For example, each brush stroke may include a falloffregion, or transition region, near the edges of the brush stroke suchthat the paint appears to fade into the background color at the edges ofthe brush. Each stroke is divided into segments that link positions of agraphical interface device, such as a stylus or other painting tool. Thepositions are recorded at successive frames as the user moves thegraphical interface device in real space, and, preferably, while theuser views a graphical rendering of the virtual object in object space.The display may represent the virtual object using a Cartesiancoordinate system, or any other coordinate system. Surface elements ofthe object which fall within a volume of influence of the tool arepainted.

FIG. 18 is a schematic diagram 1800 illustrating a method of painting asurface element 1802 affected by a brush stroke 1801, where the brushstroke 1801 has a falloff region at its edges. Similar methods areperformed for brush strokes with other attributes or characteristics.Triangle 1802 represents a surface element in object space, and triangle1802′ shows the surface element with the path of a user's brush stroke1801 superimposed. Since triangle 1802 falls within a volume ofinfluence of the brush stroke 1801, it will be painted. The surfaceelement 1802 is mapped to quadrilateral 1804 in texture space, accordingto the texture mapping methods discussed herein. Color intensitiescorresponding to the brush stroke 1801 are assigned to texels of thetexture element 1804, which is used to graphically render the surfaceelement 1802 in object space. Since the paint stroke has a falloffregion at its edges, there may be a variation of color intensitiesassigned to the texture element 1804. FIG. 18 shows how an intensity isassigned to a texel of the texture element 1804 following its scanconversion based on the position of vertices v1, v2, and v3 of thecorresponding surface element 1802.

FIG. 19 shows a block diagram 1900 of representative steps of the methodillustrated in FIG. 18. Reference 1902 indicates that the steps whichfollow are performed for each surface element within the volume ofinfluence of the brush stroke. An example surface element 1802 within avolume of influence of a brush stroke 1801 is depicted in FIG. 18. Step1904 of FIG. 19 finds vertex coordinates in texture space of the textureelement corresponding to the surface element in object space. For thesurface element 1802 in FIG. 18, the vertex coordinates v1, v2, and v3of the texture element 1804 are determined in step 1904. Then, reference1906 of FIG. 19 indicates that steps 1908, 1910, and 1912 which followare performed for each texel of the current texture element. Step 1908computes, for the current texel of the current texture element, acorresponding point vi in object space by interpolating with respect tothe vertex positions in texture space. For example, in FIG. 18, for thetexel centered at position vi in texture element 1804 in texture space,the point vi is located in triangle 1802′ in object space byinterpolating with respect to the vertex positions v1, v2, and v3 intexture space. Once the point in object space is located, step 1910 ofFIG. 19 calculates the nearest point on the stroke skeleton, and/or theshortest distance to the stroke skeleton, in order to determine a“falloff” value. For example, in FIG. 18, the point vs on the strokeskeleton nearest point vi is located, and the distance D is computed.The “falloff” value, or attenuation factor, to apply at point vi is thencomputed as a function of D. Step 1912 of FIG. 19 then uses the falloffvalue to write an attenuated version of paint color into the texel. Forexample, in FIG. 18, the computed falloff value based on distance D isused to attenuate a color value chosen for the paint stroke 1801, andthe attenuated color value is written into the texel centered at vi inthe texture element 1804.

FIG. 20 is a block diagram featuring an example computer systemarchitecture 2000 for graphically rendering a virtual object accordingto methods of the invention. The architecture 2000 in FIG. 20 ispresented in UML format. The legend 2001 describes how connected classesand textures of the architecture are related. The workspace data 2002contains a class for storing all of the texture data, designated the“Texture Manager” 2004. The “Texture Region” block 2006 in FIG. 20represents a container for all texture classes in each of the textureregions of a virtual object being graphically rendered. For example, avirtual object with three texture regions has three “Texture Region”2006 containers. The “Texture Mapper” 2008 is a list that identifiestexture elements corresponding to each of the jacks of the virtualobject being graphically rendered. For example, the “Texture Mapper”2008 may be a hash map of hash maps identifying each texture elementcorresponding to surface(s) in each jack of each jack block, as shown inthe schematic diagram 500 of FIG. 5.

For each texture region, there is an interface, labeled “ICompositeColor Texture Region” 2010 in the architecture 2000 of FIG. 20, thatrepresents a stack of texture layers for the texture region. Thisinterface 2010 is implemented by a texture that blends and stores paintlayers (and/or brush stroke layers), labeled “Composite Color TextureRegion” 2012. This texture 2012 contains a texture storing color pertexel, labeled “Color Texture Region Component” 2016 in FIG. 20, as wellas multiple textures storing paint layer data, labeled “Color TextureRegion Layer” 2022. The “Color Texture Region Component” 2016 is acontiguous texture. A contiguous texture may be needed for properbinding of a blended composite texture with a computer graphicsapplication for graphical rendering display.

The “Texture Region Component” 2014 in the architecture of FIG. 20 is atemplate for a contiguous texture class. The “Quad Texture RegionComponent” 2018 is a template for a “collapsible” texture class, whichcan be instantiated as a “Color Quad Texture Region Component” 2020, thetexture storing color per texel in collapsed form.

FIG. 21 depicts a computer system architecture 2100 that shares a numberof components with the architecture 2000 of FIG. 20, but has someadditional components. The additional components include a classmanaging the blending of paint strokes, “Texture Stroke Manager” 2104, aclass managing the undoing of paint removal during modifications of thevirtual object (i.e. during sculpting of the object), “Texture UndoManager” 2106, and a class for allocating texture, “Texture Allocator”2108. The architecture 2100 in FIG. 21 also further specifies that the“Composite Color Texture Region” 2012 texture for storing and blendingpaint layers contains multiple “Scratch Texture Region Component” 2112textures for storing temporary paint strokes (scratch textures), as wellas a “Selection Texture Region Component” 2114 texture for storing auser selection, such as a stenciled region. Textures 2112 and 2114instantiate the template for collapsed textures—the “Quad Texture RegionComponent” 2018—via a texture that stores intensity per pixel, calledthe “Intensity Quad Texture Region Component” 2110.

Any of the methods described herein for graphically rendering a virtualobject may be combined with haptic rendering of the virtual object. Forexample, an embodiment of the invention haptically renders the virtualobject in real time as the user applies a brush stroke onto the surfaceof the virtual object in object space. The haptic rendering processincludes determining a force feedback corresponding to a position of ahaptic interface device held by the user as the user applies a brushstroke using the device. The force is delivered to the user via thehaptic interface device. A haptic rendering process is described, forexample, in U.S. Pat. No. 6,552,722, by Shih et al., the text of whichis hereby incorporated by reference in its entirety.

A combined haptic and graphical rendering method of the inventionperforms haptic rendering at a substantially faster rate than graphicalrendering. This may be necessary to provide realistic force feedback tothe user. In one embodiment, graphical rendering is performed within arange from about 5 Hz to about 150 Hz, while haptic rendering isperformed within a range from about 700 Hz to about 1500 Hz. In anotherembodiment, haptic rendering is performed at about 1000 Hz, whilegraphical rendering is performed at up to about 40 Hz. Haptic andgraphical rendering of a virtual object may be performed by differentthreads of an overall rendering process.

FIGS. 22 and 23 demonstrate an improvement obtained using graphicalrendering methods of the invention. Both FIGS. 22 and 23 feature thesame virtual object whose surface has been painted by a user in objectspace. FIG. 22 is an image 2200 of a virtual object whose surface hasbeen painted using a vertex painting method A vertex painting methodassigns color values to vertices of surface elements of the object andassigns either averaged or interpolated color values to pixels of thesurface elements. There is poor resolution of the painted features onthe surface of the virtual object, particularly on relatively flatfeatures of the object such as the face, where surface elements arelarge.

FIG. 23 shows an image 2300 of the virtual object, where the surface ofthe virtual object has been painted by a user in object space using thetexture mapping methods of the invention. Improved resolution isachieved by employing texture mapping methods of the invention. As seenin FIGS. 22 and 23, lighting, shadowing, and mirroring effects may beadded in the rendering of a virtual object.

FIG. 24 is an image of a spherical virtual object with a periodictexture applied along a curved brush stroke. The periodic checkerboardpattern is used in place of the falloff brush stroke in the texturerendering methods described herein; for example, with regard to FIGS. 18and 19. FIG. 24 demonstrates the blending of a paint layer with ascratch layer, wherein the paint layer is not simply a monochromaticcolor. In FIG. 24, the blending of the paint layer and scratch layerform a checkerboard pattern about the width of the brush stroke, whosecenter is indicated by a red line.

FIG. 25 is a schematic diagram illustrating the division of a voxel intosix tetrahedra, used in performing a marching tetrahedra algorithm togenerate a surface mesh for a virtual object. As discussed elsewhereherein, an index is produced for each surface-containing voxel resultingfrom a mesh generation algorithm. The index corresponds to one of afinite number of surface element configurations, where the number ofpossible configurations depends on the mesh generation algorithmemployed. In one example, the index is a marching tetrahedra index,derived from an implementation of a marching tetrahedra algorithm usedto generate a surface mesh for a virtual object. By splitting up a cubeinto multiple tetrahedra, triangle vertices may lie along a diagonal ofthe voxel cube, increasing the resolution of the triangle mesh whilekeeping the resolution of the voxel grid constant.

The sampling structure in a marching tetrahedra approach is atetrahedron. Samples are at the vertices on a rectangular grid, where amesh cell is made up of eight samples of the grid, and the mesh cell issplit into six tetrahedra that tile the cell. FIG. 25 shows a mesh cell2500 that is split into six tetrahedra 2502, 2504, 2506, 2508, 2510,2512, where vertices of the tetrahedra coincide with vertices of thecube. The configuration of triangular surface elements through eachtetrahedron is determined by a lookup table. The index into the lookuptable for a given tetrahedron is determined from values at the fourvertices of the tetrahedron, where each value indicates whether thevertex is interior or exterior to the isosurface of the virtual objectbeing meshed. The sum of all triangular surface elements for alltetrahedra of a given cube tile the cube. The sum of all triangularsurface elements for all the cubes tile the object space.

A computer hardware apparatus may be used in carrying out any of themethods described herein. The apparatus may include, for example, ageneral purpose computer, an embedded computer, a laptop or desktopcomputer, or any other type of computer that is capable of runningsoftware, issuing suitable control commands, receiving graphical userinput, and recording information. The computer typically includes one ormore central processing units for executing the instructions containedin software code that embraces one or more of the methods describedherein. The software may include one or more modules recorded onmachine-readable media, where the term machine-readable mediaencompasses software, hardwired logic, firmware, object code, and thelike. Additionally, communication buses and I/O ports may be provided tolink any or all of the hardware components together and permitcommunication with other computers and computer networks, including theinternet, as desired.

EQUIVALENTS

While the invention has been particularly shown and described withreference to specific preferred embodiments, it should be understood bythose skilled in the art that various changes in form and detail may bemade therein without departing from the spirit and scope of theinvention as defined by the appended claims.

1. A method of graphically rendering a virtual object, the methodcomprising the steps of: (a) using an index corresponding to each of aplurality of jacks of a voxel-based virtual object to identify textureelements for which surface elements of the virtual object are mapped;and (b) generating texture coordinates of the identified textureelements in a texture space. 2-62. (canceled)